package net.uhuijia.enums;

public enum AreaLevel {

    province(0,"省"),city(1,"市"),region(2,"区");
    private int level;
    private String name;

    AreaLevel(int level, String name) {
        this.level = level;
        this.name = name;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static AreaLevel getAreaLevel(int level){
        AreaLevel areaLevel =null;
        switch (level){
            case  0:
                areaLevel = AreaLevel.province;
                break;
            case 1:
                areaLevel = AreaLevel.city;
                break;
            case 2:
                areaLevel = AreaLevel.region;
                break;
            default:
                break;
        }
        return areaLevel;
    }
}
